-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
Approved Hi @lukecarbis, Like you mentioned, I also saw that the stylesheet is loaded if it's in any of these 4 locations:
It looks like it's always enqueued in the block editor, regardless of whether a Block Lab block was added. But maybe that's intentional, as one could be added. |
@@ -351,6 +359,30 @@ public function enqueue_block_styles( $name, $type = 'block' ) { | |||
); | |||
} | |||
} | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, but this should probably have an empty line above it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 16befc7.
@kienstra Yes, always enqueuing it in the editor is intentional, so it's there and ready in case a block is added. I'll sort out that extra line now. |
Sounds good. |
…l-styles Global styles
I don't think the stylesheet should get included when you're viewing the blocks on the front-end, it should only be included when in the Gutenberg editor - otherwise you have a block stylesheet being loaded alongside your regular stylesheet. |
With this PR, Block Lab will try to enqueue a global stylesheet.
It will try to do this under one of two conditions:
Note: These styles won't load if you're not using any Block Lab blocks.
The global stylesheet will be loaded if it exists in one of these places:
{theme}/blocks/blocks.css
{theme}/blocks/css/blocks.css
{child theme}/blocks/blocks.css
{child theme}/blocks/css/blocks.css
If the global stylesheet exists in multiple places, it will only be loaded the first time it's found. So if you've got one in
blocks/blocks.css
andblocks/css/blocks.css
, then second stylesheet will be ignored.Note that once #370 is merged, the child theme will be preferenced over the parent theme.
Closes #351 .